package cn.assumejson.pro_netty.spring;

import cn.assumejson.pro_netty.netty.NettyServer;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * Spring 容器调用refresh完毕调用监听器
 *
 * @author by gang.Li 2022/3/12 0:50
 */
@Component
public class NettyApplicationListener implements ApplicationListener<ContextRefreshedEvent> {
    @Override
    public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
        // 调用netty 服务
        new Thread(NettyServer::start).start();
    }
}
